import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from 'views/home/Home.vue'
import Search from 'views/search/Search'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home',
  },
  {
    path: '/home',
    component: Home,
  },
  {
    path: '/search',
    component: Search,
    children: [
      {
        path: '/',
        redirect: './form',
      },
      {
        path: 'form',
        component: () => import('views/search/childComps/FormSearch'),
      },
      {
        path: 'result',
        name: 'result',
        component: () => import('views/search/childComps/ResultSearch'),
      },
    ],
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes,
})

export default router
